/*
 * @Author: 颜礼田 2564217790@qq.com
 * @Date: 2024-09-07 16:50:10
 * @LastEditors: 颜礼田 2564217790@qq.com
 * @LastEditTime: 2024-09-07 17:40:38
 * @FilePath: /webServer/src/model/permission/permission.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { Column, Entity, ManyToMany } from 'typeorm';
import { DBColumns } from '../';
import { PermissionSchema, RoleSchema } from '../../schema';
import { Role } from '../role/role';

@Entity('permission')
export class Permission extends DBColumns implements PermissionSchema {
  @Column({
    type: 'varchar',
    length: 50,
    nullable: false,
    default: null,
    comment: '权限名称',
  })
  permissionName: string;

  @Column({
    type: 'varchar',
    length: 50,
    nullable: false,
    default: null,
    comment: '权限编码',
  })
  permissionCode: string;

  @ManyToMany(() => Role, role => role.permission)
  role: RoleSchema[];
}
